*************************************************************************************************
* Program to make RATS dataset for use in regression-based tests of statistical significance
* of NSR declines for statistical detrending methods manifesting consistent improvement
*************************************************************************************************
* All data is read in as "___.rat" files.  However, code is included to also allow data to be read
* in as "___.db" (fame) and "___.xls" (excel) files (though this is commented out).  All data is
* written out as "___.rat", "___.db", and "___.xls" files.
*************************************************************************************************

calendar 1947 1 4
allocate 2020:04

*************************************************************************************************
* Reading the data in as "___.rat" files.
*************************************************************************************************

open data revgapsq_fnv_32yrs.rat
data(format=rats) / hp_revgapsq_f32 hc_revgapsq_f32 bk_revgapsq_f32 bn_revgapsq_f32

open data revgapvr_fnv_32yrs.rat
data(format=rats) / hp_revgapvr_f32 hc_revgapvr_f32 bk_revgapvr_f32 bn_revgapvr_f32

open data revgapsq_fnv_9yrs.rat
data(format=rats) / hp_revgapsq_f09 hc_revgapsq_f09 bk_revgapsq_f09 bn_revgapsq_f09

open data revgapvr_fnv_9yrs.rat
data(format=rats) / hp_revgapvr_f09 hc_revgapvr_f09 bk_revgapvr_f09 bn_revgapvr_f09

open data revgapsq_fnv_13yrs.rat
data(format=rats) / bk_revgapsq_f13

open data revgapvr_fnv_13yrs.rat
data(format=rats) / bk_revgapvr_f13

*************************************************************************************************
* For reference (but commented out), reading the data in as "___.db" or "___.xls" files.
*************************************************************************************************
/*
open data revgapsq_fnv_32yrs.db
data(format=fame) / hp_revgapsq_f32 hc_revgapsq_f32 bk_revgapsq_f32 bn_revgapsq_f32

open data revgapvr_fnv_32yrs.db
data(format=fame) / hp_revgapvr_f32 hc_revgapvr_f32 bk_revgapvr_f32 bn_revgapvr_f32

open data revgapsq_fnv_9yrs.db
data(format=fame) / hp_revgapsq_f09 hc_revgapsq_f09 bk_revgapsq_f09 bn_revgapsq_f09

open data revgapvr_fnv_9yrs.db
data(format=fame) / hp_revgapvr_f09 hc_revgapvr_f09 bk_revgapvr_f09 bn_revgapvr_f09

open data revgapsq_fnv_13yrs.db
data(format=fame) / bk_revgapsq_f13

open data revgapvr_fnv_13yrs.db
data(format=fame) / bk_revgapvr_f13


open data revgapsq_fnv_32yrs.xls
data(format=xls,org=obs) / hp_revgapsq_f32 hc_revgapsq_f32 bk_revgapsq_f32 bn_revgapsq_f32

open data revgapvr_fnv_32yrs.xls
data(format=xls,org=obs) / hp_revgapvr_f32 hc_revgapvr_f32 bk_revgapvr_f32 bn_revgapvr_f32

open data revgapsq_fnv_9yrs.xls
data(format=xls,org=obs) / hp_revgapsq_f09 hc_revgapsq_f09 bk_revgapsq_f09 bn_revgapsq_f09

open data revgapvr_fnv_9yrs.xls
data(format=xls,org=obs) / hp_revgapvr_f09 hc_revgapvr_f09 bk_revgapvr_f09 bn_revgapvr_f09

open data revgapsq_fnv_13yrs.xls
data(format=xls,org=obs) / bk_revgapsq_f13

open data revgapvr_fnv_13yrs.xls
data(format=xls,org=obs) / bk_revgapvr_f13
*/

*************************************************************************************************
* Writing all the gap estimates to files.
*************************************************************************************************

open copy table2_reg_test_data.rat
copy(format=rats) / hp_revgapsq_f32 hc_revgapsq_f32 bk_revgapsq_f32 bn_revgapsq_f32 $
                    hp_revgapvr_f32 hc_revgapvr_f32 bk_revgapvr_f32 bn_revgapvr_f32 $
                    hp_revgapsq_f09 hc_revgapsq_f09 bk_revgapsq_f09 bn_revgapsq_f09 $
                    hp_revgapvr_f09 hc_revgapvr_f09 bk_revgapvr_f09 bn_revgapvr_f09 $
                    bk_revgapsq_f13 bk_revgapvr_f13

open copy table2_reg_test_data.db
copy(format=fame) / hp_revgapsq_f32 hc_revgapsq_f32 bk_revgapsq_f32 bn_revgapsq_f32 $
                    hp_revgapvr_f32 hc_revgapvr_f32 bk_revgapvr_f32 bn_revgapvr_f32 $
                    hp_revgapsq_f09 hc_revgapsq_f09 bk_revgapsq_f09 bn_revgapsq_f09 $
                    hp_revgapvr_f09 hc_revgapvr_f09 bk_revgapvr_f09 bn_revgapvr_f09 $
                    bk_revgapsq_f13 bk_revgapvr_f13

open copy table2_reg_test_data.xls
copy(format=xls,org=obs,dates) / hp_revgapsq_f32 hc_revgapsq_f32 bk_revgapsq_f32 bn_revgapsq_f32 $
                    hp_revgapvr_f32 hc_revgapvr_f32 bk_revgapvr_f32 bn_revgapvr_f32 $
                    hp_revgapsq_f09 hc_revgapsq_f09 bk_revgapsq_f09 bn_revgapsq_f09 $
                    hp_revgapvr_f09 hc_revgapvr_f09 bk_revgapvr_f09 bn_revgapvr_f09 $
                    bk_revgapsq_f13 bk_revgapvr_f13

* halt
